<template>
  <view :style="themeColor">
    <view class="page">
      <view class="flex flex-direction align-stretch justify-between benben-position-layout flex searchResult_flex_0"
        :style="{height:(93+StatusBarRpx)+'rpx',paddingTop:StatusBarRpx+'rpx', }">
        <view class='flex flex-wrap align-center justify-between searchResult_fd0_0'>
          <text class='fu-iconfont2  searchResult_fd0_0_c0' @tap.stop="handleJumpDiy" data-type="back"
            data-url="1">&#xE794;</text>
          <view class='flex flex-wrap align-center flex-sub searchResult_fd0_0_c1'>
            <benben-input class='flex-sub searchResult_fd0_0_c1_c0' type="text" :placeholder="`请输入`" confirm-type="done"
              v-model="keyword" :maxlength="-1" placeholder-style="color:#999;font-size:24rpx" />
          </view>
          <text class='fu-iconfont2  searchResult_fd0_0_c2'>&#xe741;</text>
        </view>

      </view>
      <view :style="{height: (93+StatusBarRpx)+'rpx'}"></view>
      <!---flex布局flex布局开始-->
      <view class="flex benben-flex-layout flex-wrap align-center">
        <view class='flex flex-wrap align-center'>
          <view>
            <benben-flex-tabs class-name='searchResult_benbenTabsfd1_0_c0' v-model="tabid" ref="benben_tabsfd1_0_c0"
              @change="getListFunc()" select-mark="benben_tabsfd1_0_c0" key="benben_tabsfd1_0_c0"
              :open-title-type='false' :open-sticky='true' :top='0' :is-show-content='false' :scrollspy='false'
              :tabs-info.sync="tabsInfofd1_0_c0">

              <scroll-view @scroll="tabsInfofd1_0_c0.scrollX = $event.detail.scrollLeft" id="benben_tabsfd1_0_c0"
                class="benben-tabs" style="width:300rpx" :scroll-x="true" :scroll-left.sync="tabsInfofd1_0_c0.moveX"
                scroll-with-animation="all .3s ease">
                <view class="benben-tabs-content" id="benben_tabsfd1_0_c0-content">
                  <view id="benben_tabsfd1_0_c0-title" class="benben-tabs-title flex align-center justify-around flex ">
                    <template v-for='(item,key0) in tabs'>
                      <view :key='key0'
                        :class="{ 'checkTitlefd1_0_c0': tabid == item.value, 'flex flex-wrap align-center': true }"
                        @tap="tabid = item.value" :id="`benben_tabsfd1_0_c0-title-item-${item.value}`">

                        <text>{{item.name}}</text>

                      </view>
                    </template>
                  </view>
                  <view :style="{ left: tabsInfofd1_0_c0.lineleft, maxWidth: tabsInfofd1_0_c0.lineWidth ,}"
                    id="benben_tabsfd1_0_c0-line"
                    class="benben-tabs-line flex benben-flex-tabs-line searchResult_linefd1_0_c0"></view>
                </view>
              </scroll-view>

            </benben-flex-tabs>

          </view>
        </view>
      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction align-stretch benben-flex-layout searchResult_flex_2">
        <view class='flex flex-wrap align-center justify-between' v-if=" tabid=='2'">
          <template v-for='(item,key0) in dataList'>
            <view class='flex flex-direction flex-wrap align-stretch searchResult_fd2_0_c0' @tap.stop="handleJumpDiy"
              data-type="navigateTo" :data-url="`/pages/fl/shopDetail/shopDetail?id=${item.id}`" :key='key0'>
              <image class='searchResult_fd2_0_c0_c0' mode="aspectFill" :src='item.coverPic'>
              </image>
              <!-- <image class='searchResult_fd2_0_c0_c0' mode="aspectFill" :src='item.coverPic' v-if="commoditype=='2'"> -->
              </image>
              <text class='flex-sub searchResult_fd2_0_c0_c1'>{{item.comdName}}</text>
              <view class='flex flex-direction align-stretch searchResult_fd2_0_c0_c2'>
                <view class='flex flex-wrap align-center searchResult_fd2_0_c0_c2_c0'>
                  <image class='searchResult_fd2_0_c0_c2_c0_c0' mode="aspectFit" :src='STATIC_URL+"500.png"'></image>
                  <text class='searchResult_fd2_0_c0_c2_c0_c1'>￥{{item.rentPrice}}/月</text>
                </view>
                <view class='flex flex-wrap align-center'>
                  <image class='searchResult_fd2_0_c0_c2_c0_c0' mode="aspectFit" :src='STATIC_URL+"501.png"'></image>
                  <text class='searchResult_fd2_0_c0_c2_c0_c1'>￥{{item.sellPrice}}</text>
                </view>
              </view>
              <view class='flex flex-wrap align-center justify-between searchResult_fd2_0_c0_c3'
                @tap.stop="handleJumpDiy" data-type="navigateTo"
                :data-url="`/pages/sy/shopdetail/shopdetail?usermerchant_aid=${item.shopIdk}`">
                <text class='searchResult_fd2_0_c0_c3_c0'>{{item.shopName}}</text>
                <view class='flex flex-wrap align-center'>
                  <text class='searchResult_fd2_0_c0_c3_c0'>进店</text>
                  <text class='fu-iconfont2  searchResult_fd2_0_c0_c3_c1_c1'>&#xe7f2;</text>
                </view>
              </view>
            </view>
          </template>
          <!--       <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
            :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty> -->
        </view>

      </view>

      <!---flex布局flex布局结束-->
      <!---flex布局flex布局开始-->
      <view class="flex flex-direction align-stretch benben-flex-layout searchResult_flex_3">
        <template v-for='(item,key0) in dataList'>
          <view class='flex flex-direction flex-wrap align-stretch searchResult_fd3_0' v-if=" tabid=='1'" :key='key0'>
            <view class='flex flex-direction align-stretch'>
              <view class='flex align-stretch'>
                <image class='searchResult_fd3_0_c0_c0_c0' mode="aspectFill" :src='item.coverPic'></image>
                <view class='flex flex-direction align-stretch flex-sub searchResult_fd3_0_c0_c0_c1'>
                  <text class='searchResult_fd3_0_c0_c0_c1_c0'>{{item.shopName}}</text>
                  <view class='flex flex-direction flex-wrap align-stretch searchResult_fd3_0_c0_c0_c1_c1'>
                    <view class='flex flex-wrap align-center'>
                      <text>电话</text>
                      <text class='searchResult_fd3_0_c0_c0_c1_c1_c0_c1'>{{item.shopPhone}}</text>
                    </view>
                    <view class='flex align-stretch'>
                      <text class='searchResult_fd3_0_c0_c0_c1_c1_c1_c0'>位置</text>
                      <text class='searchResult_fd3_0_c0_c0_c1_c1_c1_c1'>{{item.address}}</text>
                    </view>
                  </view>
                </view>
                <view class='flex flex-direction align-stretch justify-between' @tap.stop="handleJumpDiy"
                  data-type="navigateTo" :data-url="`/pages/sy/shopdetail/shopdetail?usermerchant_aid=${item.id}`">
                  <view class='flex flex-wrap align-start' v-if=" item.distance!=0">
                    <text class='searchResult_fd3_0_c0_c0_c2_c0_c0'>{{item.distance}}</text>
                    <text class='searchResult_fd3_0_c0_c0_c2_c0_c0'>km</text>
                  </view>
                  <view class='flex flex-direction align-center'>
                    <image class='searchResult_fd3_0_c0_c0_c2_c1_c0' mode="aspectFit" :src='STATIC_URL+"512.png"'>
                    </image>
                    <text class='searchResult_fd3_0_c0_c0_c2_c1_c1'>导航</text>
                  </view>
                </view>
              </view>
            </view>
          </view>
        </template>

      </view>

      <!---flex布局flex布局结束-->

      <fu-empty :pagingListLoadedAll="pagingListLoadedAll" :pagingListNoListData="pagingListNoListData"
        :listDataLength="listDataLength" :isLoadInit="isLoadInit"></fu-empty>
    </view>

  </view>
</template>
<script>
  import pagingList from '@/common/mixin/paging_list.js';
  import {
    validate
  } from '@/common/utils/validate.js'

  export default {
    components: {},
    mixins: [pagingList],

    data() {
      return {
        "tabsInfofd1_0_c0": {
          lineleft: '',
          lineWidth: '',
          moveX: 0,
          scrollX: 0,
          PageScrollX: 0
        },
        "minixPagingListsApi": "",
        "pageingListApiMethod": "",
        "allowOnloadGetList": false,
        "tabs": [{
          "name": "门店",
          "value": "1",
          "image": ""
        }, {
          "name": "商品",
          "value": "2",
          "image": ""
        }],
        "tabid": "1",
        "dataList": [],
        "commoditype": "1",
        "storList": [],
        keyword: ''
      };
    },
    computed: {
      themeColor() {
        return this.$store.getters.themeColor
      },

    },
    watch: {},
    onLoad(options) {
      let {
        keyword
      } = options
      if (keyword !== undefined) this.keyword = keyword
      this.getListFunc()
    },
    onUnload() {

    },
    onReady() {

    },
    onShow() {

    },
    onHide() {

    },
    onResize() {

    },
    onPullDownRefresh() {
      this.getListFunc()
    },
    onReachBottom(e) {

    },
    onPageScroll(e) {

    },
    methods: {
      //积分商城-积分商品列表
      getListFunc() {
        let urls = ''
        if (this.tabid == 1) { //门店
          urls = global.apiUrls.qrySearchShopItem
        } else {
          urls = global.apiUrls.qrySearchCommodItem
        }
        this.minixPagingListsApi = urls;
        this.pageingListApiMethod = 'get';
        this.allowOnloadGetList = false;
        this.pagingListPostDataContent = {
          searchName: this.keyword
        }
        this.listData = [];
        this.dataList = this.listData;
        this.pagingListToggle();

      },
      pagingListPostData() {
        return this.pagingListPostDataContent
      }
    }
  };
</script>
<style lang="scss" scoped>
  .page {
    width: 100vw;
    overflow-x: hidden;
    min-height: calc(100vh - var(--window-bottom));
    background: #F8F8F8;
    background-size: 100% auto;
  }

  .searchResult_flex_0 {
    background: #fff;
    width: 750rpx;
    height: 93rpx;
    overflow: hidden;
    z-index: 10;
    top: 0rpx;
    background-size: #eee;
  }

  .searchResult_fd0_0_c2 {
    margin: 0rpx 0rpx 0rpx 24rpx;
  }

  .searchResult_fd0_0_c1_c0 {
    font-size: 24rpx;
    font-weight: 400;
    color: #333;
  }

  .searchResult_fd0_0_c1 {
    background: rgba(249, 249, 249, 1);
    height: 64rpx;
    background-size: 100% auto !important;
    border-radius: 34rpx 34rpx 34rpx 34rpx;
    padding: 0rpx 24rpx 0rpx 24rpx;
    font-size: 28rpx;
    font-weight: 400;
    color: #333;
  }

  .searchResult_fd0_0_c0 {
    font-size: 36rpx;
    font-weight: 500;
    color: #333;
    margin: 0rpx 34rpx 0rpx 0rpx;
  }

  .searchResult_fd0_0 {
    padding: 0rpx 24rpx 0rpx 35rpx;
    line-height: 93rpx;
  }

  .searchResult_linefd1_0_c0 {
    background: rgba(50, 127, 251, 1);
    width: 200rpx;
    height: 8rpx;
    top: 80rpx;
    background-size: 100% auto !important;
  }

  .checkTitlefd1_0_c0 {
    font-weight: 700 !important;
    font-size: 28rpx !important;
    color: #327FFB !important;
    background-color: rgba(255, 255, 255, 1) !important;
  }

  ::v-deep .searchResult_benbenTabsfd1_0_c0 {
    background: #fff;
    width: 750rpx;
    height: 90rpx;
    white-space: nowrap;
    text-align: center;
  }

  .searchResult_flex_2 {
    padding: 0rpx 24rpx 0rpx 24rpx;
    margin-top: 24rpx;
  }

  .searchResult_fd2_0_c0_c3_c1_c1 {
    font-size: 22rpx;
    color: var(--benbenFontColor1);
  }

  .searchResult_fd2_0_c0_c3_c0 {
    color: var(--benbenFontColor1);
    font-size: 24rpx;
  }

  .searchResult_fd2_0_c0_c3 {
    background: rgba(246, 246, 246, 1);
    padding: 6rpx;
    border-radius: 44rpx;
    background-size: 100% auto;
    width: 300rpx;
    margin: 12rpx auto 0rpx auto;
  }

  .searchResult_fd2_0_c0_c2_c0_c1 {
    color: rgba(217, 50, 32, 1);
    font-weight: 600;
  }

  .searchResult_fd2_0_c0_c2_c0_c0 {
    width: 32rpx;
    height: 32rpx;
    margin: 0rpx 10rpx 0rpx 0rpx;
  }

  .searchResult_fd2_0_c0_c2_c0 {
    margin: 12rpx 0rpx 12rpx 0rpx;
  }

  .searchResult_fd2_0_c0_c2 {
    margin: 0rpx 20rpx 0rpx 20rpx;
  }

  .searchResult_fd2_0_c0_c1 {
    font-size: 28rpx;
    font-weight: 500;
    color: rgba(51, 51, 51, 1);
    margin: 0rpx 20rpx 0rpx 20rpx;
    -webkit-line-clamp: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
  }

  .searchResult_fd2_0_c0_c0 {
    width: 346rpx;
    height: 346rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    margin: 0rpx 0rpx 24rpx 0rpx;
  }

  .searchResult_fd2_0_c0 {
    background: #fff;
    background-size: 100% auto !important;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
    padding: 0rpx 0rpx 22rpx 0rpx;
    margin: 0rpx 0rpx 8rpx 0rpx;
    width: 346rpx;
  }

  .searchResult_flex_3 {
    padding: 0rpx 32rpx 0rpx 32rpx;
  }

  .searchResult_fd3_0_c0_c0_c2_c1_c1 {
    font-size: 24rpx;
    color: var(--benbenFontColor4);
  }

  .searchResult_fd3_0_c0_c0_c2_c1_c0 {
    width: 33rpx;
    height: 33rpx;
    border-radius: 0rpx 0rpx 0rpx 0rpx;
  }

  .searchResult_fd3_0_c0_c0_c2_c0_c0 {
    color: var(--benbenFontColor6);
    font-size: 22rpx;
  }

  .searchResult_fd3_0_c0_c0_c1_c1_c1_c1 {
    margin: 0rpx 0rpx 0rpx 24rpx;
    max-width: 250rpx;
  }

  .searchResult_fd3_0_c0_c0_c1_c1_c1_c0 {
    width: 60rpx;
  }

  .searchResult_fd3_0_c0_c0_c1_c1_c0_c1 {
    margin: 0rpx 0rpx 0rpx 24rpx;
  }

  .searchResult_fd3_0_c0_c0_c1_c1 {
    color: var(--benbenFontColor2);
  }

  .searchResult_fd3_0_c0_c0_c1_c0 {
    color: var(--benbenFontColor0);
    font-size: 32rpx;
    font-weight: 700;
    margin: 0rpx 0rpx auto 0rpx;
  }

  .searchResult_fd3_0_c0_c0_c1 {
    margin: 0rpx 16rpx 0rpx 16rpx;
  }

  .searchResult_fd3_0_c0_c0_c0 {
    width: 184rpx;
    height: 184rpx;
    border-radius: 8rpx;
  }

  .searchResult_fd3_0 {
    background: var(--benbenbgColor1);
    background-size: 100% auto !important;
    margin: 20rpx 0rpx 0rpx 0rpx;
    padding: 32rpx 24rpx 32rpx 24rpx;
    border-radius: 16rpx 16rpx 16rpx 16rpx;
  }
</style>
